package edu.stu.mall.repository

import edu.mall.http.ApiAddress.Article_List
import edu.mall.http.ApiAddress.Cart_List
import edu.mall.http.ApiAddress.Mall_Banner
import edu.mall.http.ApiAddress.Mall_Login
import edu.mall.http.ApiAddress.Product_Category
import edu.mall.http.ApiAddress.Product_Detail
import edu.mall.http.ApiAddress.Recommended_Product_List
import edu.mall.http.ApiAddress.User_Info
import edu.mall.http.BaseResponse
import edu.stu.mall.repository.data.BannerListData
import edu.stu.mall.repository.data.CartListData
import edu.stu.mall.repository.data.HomeListData
import edu.stu.mall.repository.data.LoginData
import edu.stu.mall.repository.data.ProductCategoryListData
import edu.stu.mall.repository.data.ProductCategoryListDataItem
import edu.stu.mall.repository.data.ProductDetailData
import edu.stu.mall.repository.data.RecommendedProductData
import edu.stu.mall.repository.data.UserInfo
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query

interface ApiService {

    /*获取首页数据
    * https://www.wanandroid.com/article/list/0/json
    * */
    @GET("$Article_List{pageCount}/json")
    suspend fun homeList(@Path("pageCount") pageCount: String): BaseResponse<HomeListData?>?


    /*
    *   分页获取推荐商品11
    http://localhost:8085/home/recommendProductList?pageNum=1&pageSize=6
    * */
    @GET(Recommended_Product_List)
    suspend fun recommendedProductList(
        @Query("pageNum") pageNum: String = "1",
        @Query("pageSize") pageSize: String = "12"
    ): BaseResponse<RecommendedProductData?>?


    /**
     * 获取banner数据
     *
     * http://localhost:8085/home/content
     */
    @GET(Mall_Banner)
    suspend fun mallBanner(): BaseResponse<BannerListData>?

    /*
    * 商品详情
    * http://localhost:8085/product/detail/26
    * */

    @GET("$Product_Detail{pid}")
    suspend fun productDetail(@Path("pid") pid: String): BaseResponse<ProductDetailData?>?
    @GET("$Cart_List")
    suspend fun cartList(): BaseResponse<CartListData?>?


    /*
    *
    * 以树形结构获取所有商品分类2
    * http://localhost:8085/product/categoryTreeList
    * */
    @GET(Product_Category)
    suspend fun productCategory(): BaseResponse<ProductCategoryListData>?

    /*
    * 登录
    * http://localhost:8085/sso/login?password=member123&username=member
    *
    * */

    @POST(Mall_Login)
    suspend fun login(
        @Query("password") password: String = "member123",
        @Query("username") username: String = "member"
    ): BaseResponse<LoginData?>?

    @GET(User_Info)
    suspend fun userInfo(): BaseResponse<UserInfo>?



}